<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>SmartShop Manage System</title>
{load href="__PUBLIC__/base/base.css,__PUBLIC__/admin/style.css,__PUBLIC__/js/do.js,__PUBLIC__/js/package.js,__PUBLIC__/admin/common.js" /}
</head>
<style type="text/css">
#main {background: none}
#upButton{text-align: center;padding: 25px;}
</style>
<body>
<div id="main">
    <div id="upButton">请选择要上传的证书文件</a></div>
</div>
<script type="text/javascript">
Do('layer','upload','tab',function(){
    var uploader = WebUploader.create({
        swf: '{__PUBLIC__}js/Plug-in/uploader/Uploader.swf',
        pick: '#upButton',auto: true,fileNumLimit:1,
        server:'{:url("system/admin.common/cert")}',
        accept: {title: 'Images',extensions: 'pem'}
    });
    //上传完毕
    uploader.on( 'uploadSuccess', function(file,data) {
        if(data.error == 1){
            parent.layer.alert(data.message,{icon: 6},function(i){
                parent.layer.close(i);
                window.location.reload()
            });
        }else{
            saveImage(data.url)
        }
    });
})
function saveImage(url){
    var index = parent.layer.getFrameIndex(window.name); 
    parent.layer.close(index);
    parent.$("#iframe").contents().find("#{$input}").val(url);   
}
</script>
</body>
</html>